package main
import (
	"fmt"
	"unsafe"
	"strconv"
)
func main(){
	n := 100
	fmt.Printf("n's type is :%T\n",n)
	var t int64 = 10
	fmt.Printf("t's type is :%T\tuse byte is:%d\n",t, unsafe.Sizeof(t))
	var n2 byte = 255
	fmt.Printf("n2's type is :%T\n",n2)
	var n3 uint = 123131
	fmt.Printf("n3's type is :%T\n",n3)
	var price float32 = 12.25
	var height float64 = 12.22
	fmt.Println("price:",price,"height:",height)

	var num1 int64 = 1231
	var num2 int8 = int8(num1)
	fmt.Printf("num2 = %d\n",num2)
	var str string = "hello world!"+
	"my name is mason"
	fmt.Println(str)
	//反引号可以保留源码，让其无意义
	str2 := `	var num1 int64 = 1231 
	var num2 int8 = int8(num1)
	fmt.Printf("num2 = %d",num2)
	var str string = "hello world!"+
	"my name is mason"
	fmt.Println(str)`
	fmt.Println(str2)
	char := 'a'
	fmt.Printf("char : %c\n" , char)

	var n1 int = 99
	var f1 float64 = 23.909
	var b bool = false
	var str_temp string

	str_temp = fmt.Sprintf("%d",n1)
	fmt.Println(str_temp)
	str_temp = fmt.Sprintf("%f",f1)
	fmt.Println(str_temp)
	str_temp = fmt.Sprintf("%t",b)
	fmt.Println(str_temp)

	str_temp = strconv.FormatInt(int64(n1),10)
	fmt.Println(str_temp)
	str_temp = strconv.FormatFloat(f1,'f',10,64)
	fmt.Println(str_temp)
	str_temp = strconv.FormatBool(b)
	fmt.Println(str_temp)

	var string1 string = "12345"
	var number1 int64
	number1 , _ = strconv.ParseInt(string1, 10, 64)
	fmt.Printf("%T : %v \n",number1,number1)
	var string2 string = "hello"//"12.345"
	var number2 float64
	number2 , _ = strconv.ParseFloat(string2, 64)
	fmt.Printf("%T : %v \n",number2,number2)
	var bool1 bool
	var string3 string = "hello"
	bool1 , _ = strconv.ParseBool(string3)
	fmt.Printf("%T : %v \n",bool1,bool1)
}